home *** CD-ROM | disk | FTP | other *** search
- program object_initialization;
-
- {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
- { Program to illustrate the initialization of a record by the use of an }
- { object as opposed to conventional methods. R. Shaw 17.2.91 }
- { OBJINIT.PAS -> OBJINIT.EXE }
- {________________________________________________________________________}
-
- uses Crt;
-
- type
- obj = object
- i : integer;
- r : real;
- s : string[50];
- procedure Init( int : integer; re : real; st : string);
- end;
-
- procedure Obj.Init( int : integer; re : real; st : string);
-
- begin
- begin
- i := int;
- r := re;
- s := st;
- end;
- end; { of method Obj.Init }
-
- var
- ThisObj : obj;
-
- begin
- ClrScr;
- ThisObj.Init(1234, 9.876, 'This is the string entry for this object');
- writeln( 'The integer value is ', ThisObj.i);
- writeln( 'The real value is ', ThisObj.r);
- writeln( 'The string is " ', ThisObj.s, '"');
- writeln;
- writeln;
- write('Press any key to continue: ');
- repeat until keypressed;
- end.
-
-